﻿// <copyright>
// Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>

using System.Globalization;
using System.Runtime.Serialization;

namespace CloudMLDemo.Models
{
    public class AzureBlobDataReference
    {
        /// <summary>
        /// Storage connection string used for a regular blob. 
        /// It's not necessary for a shared access signature blob
        /// </summary>
        [DataMember]
        public string ConnectionString { get; set; }

        /// <summary>
        /// Relative uri for the blob
        /// </summary>
        [DataMember]
        public string RelativeLocation { get; set; }

        /// <summary>
        /// Base url only used for a shared access signature blob 
        /// </summary>
        [DataMember]
        public string BaseLocation { get; set; }

        /// <summary>
        /// Shared access signature part only used for a shared access signature blob 
        /// </summary>
        [DataMember]
        public string SasBlobToken { get; set; }

        public override string ToString()
        {
            // skip ConnectionString since it's user credential
            return string.Format(
                CultureInfo.InvariantCulture,
                "[AzureBlobDataReference: RelativeLocation={0},BaseLocation={1},SasToken={2}]",
                RelativeLocation,
                BaseLocation,
                SasBlobToken);
        }
    }
}